#include <stdio.h>
typedef long long LL;
const LL MOD = 998244353;
const int MAXN = 1e5+7;
LL Fac[MAXN], RFac[MAXN];
LL rev[MAXN];
LL FastPOW(LL a, LL k) {
	LL ret = 1;
	while (k) {
		if (k&1) {
			ret = (ret * a) % MOD;
		}
		k = (k >> 1);
		a = (a * a) % MOD;
	}
	return ret;
}
void Init() {
	Fac[0] = 1;
	for (int i=1; i<MAXN; ++i) {
		Fac[i] = (Fac[i-1] * i) % MOD;
		rev[i] = (MOD - rev[MOD%i]) * (MOD/i) % MOD;
	}
	RFac[MAXN-1] = FastPOW(Fac[MAXN-1], MOD-2);
	for (int i=MAXN-1; i>0; --i) {
		RFac[i-1] = (RFac[i] * i) % MOD;
	}
}
LL C(LL n, LL k) {
	return Fac[n] * RFac[k] % MOD * RFac[n-k] % MOD;
}

int main(int argc, char** argv) {
	#ifdef hai
	freopen("in.txt", "r", stdin);
	#endif
	Init();
	int T;
	scanf("%d", &T);
	int n;
	while (T--) {
		scanf("%d", &n);
		LL res = 0;
		for (int i=0; i<n; ++i) {
			if (i&1) {
				res = (res - C(n, i) * Fac[n-i-1]) % MOD;
			}
			else {
				res = (res + C(n, i) * Fac[n-i-1]) % MOD;
			}
		}
		if (n&1) {
			--res;
		}
		else {
			++res;
		}
		res %= MOD;
		if (res < 0) res += MOD;
		printf("%lld\n", res);
	}
	return 0;
} 
